000100 IDENTIFICATION DIVISION.
000200 PROGRAM-ID. CHINESE-TAX-SYSTEM.
000300 AUTHOR. ctkqiang.
000400 DATE-WRITTEN. 2025-07-14.
000500
000600 ENVIRONMENT DIVISION.
000700 CONFIGURATION SECTION.
000800 SOURCE-COMPUTER. IBM-370.
000900 OBJECT-COMPUTER. IBM-370.
001000
001100 DATA DIVISION.
001200 WORKING-STORAGE SECTION.
001300
001400 01  INPUT-FIELDS.
001500     05  GROSS-INCOME          PIC 9(7)V99.
001600     05  SOCIAL-INSURANCE      PIC 9(5)V99.
001700     05  HOUSING-FUND          PIC 9(5)V99.
001800     05  OTHER-DEDUCTIONS      PIC 9(5)V99.
001900
002000 01  CALCULATED-VALUES.
002100     05  STANDARD-DEDUCTION    PIC 9(5)V99 VALUE 5000.00.
002200     05  TOTAL-DEDUCTIONS      PIC 9(7)V99.
002300     05  TAXABLE-INCOME        PIC S9(7)V99.
002400     05  TAX-AMOUNT            PIC S9(7)V99.
002500
002600* Tax bracket thresholds
002700 01  TAX-BRACKETS.
002800     05  BRACKET-1             PIC 9(5)V99 VALUE 3000.00.
002900     05  BRACKET-2             PIC 9(5)V99 VALUE 12000.00.
003000     05  BRACKET-3             PIC 9(5)V99 VALUE 25000.00.
003100     05  BRACKET-4             PIC 9(5)V99 VALUE 35000.00.
003200     05  BRACKET-5             PIC 9(5)V99 VALUE 55000.00.
003300     05  BRACKET-6             PIC 9(5)V99 VALUE 80000.00.
003400
003500* Tax rates
003600 01  TAX-RATES.
003700     05  RATE-1                PIC V999 VALUE 0.03.
003800     05  RATE-2                PIC V999 VALUE 0.10.
003900     05  RATE-3                PIC V999 VALUE 0.20.
004000     05  RATE-4                PIC V999 VALUE 0.25.
004100     05  RATE-5                PIC V999 VALUE 0.30.
004200     05  RATE-6                PIC V999 VALUE 0.35.
004300     05  RATE-7                PIC V999 VALUE 0.45.
004400
004500* Display formatting
004600 01  DISPLAY-VALUES.
004700     05  DISPLAY-INCOME        PIC Z,ZZZ,ZZ9.99.
004800     05  DISPLAY-TAX           PIC Z,ZZZ,ZZ9.99.
004900     05  DISPLAY-TAXABLE       PIC Z,ZZZ,ZZ9.99.
005000     05  DISPLAY-NET           PIC Z,ZZZ,ZZ9.99.
005100
005200* Control variables
005300 01  CONFIRMATION             PIC X.
005400
005500 PROCEDURE DIVISION.
005600 MAIN-LOGIC.
005700     DISPLAY "中国个人所得税计算器 (China Personal Income Tax Calculator)".
005800     DISPLAY "=============================================".
005900
006000     PERFORM GET-USER-INPUT.
006100     PERFORM CALCULATE-TAX.
006200     PERFORM DISPLAY-RESULTS.
006300
006400     STOP RUN.
006500
006600 GET-USER-INPUT.
006700     DISPLAY "请输入月收入 (Enter monthly gross income in RMB): ".
006800     ACCEPT GROSS-INCOME.
006900
007000     DISPLAY "请输入社保金额 (Enter social insurance amount): ".
007100     ACCEPT SOCIAL-INSURANCE.
007200
007300     DISPLAY "请输入住房公积金 (Enter housing fund amount): ".
007400     ACCEPT HOUSING-FUND.
007500
007600     DISPLAY "请输入其他扣除项 (Enter other deductions, if any): ".
007700     ACCEPT OTHER-DEDUCTIONS.
007800
007900     COMPUTE TOTAL-DEDUCTIONS = SOCIAL-INSURANCE + HOUSING-FUND
008000                           + OTHER-DEDUCTIONS + STANDARD-DEDUCTION.
008100
008200     DISPLAY " ".
008300     DISPLAY "汇总 (Summary):".
008400     DISPLAY "总收入 (Gross Income): RMB " GROSS-INCOME.
008500     DISPLAY "总扣除项 (Total Deductions): RMB " TOTAL-DEDUCTIONS.
008600     DISPLAY " ".
008700     DISPLAY "确认计算? (Y/N) (Confirm calculation?): ".
008800     ACCEPT CONFIRMATION.
008900
009000     IF CONFIRMATION NOT = 'Y' AND 'y'
009100         DISPLAY "计算取消 (Calculation cancelled)"
009200         STOP RUN.
009300
009400 CALCULATE-TAX.
009500     COMPUTE TAXABLE-INCOME = GROSS-INCOME - TOTAL-DEDUCTIONS.
009600
009700     IF TAXABLE-INCOME <= 0
009800         MOVE 0 TO TAX-AMOUNT
009900         GO TO CALCULATION-COMPLETE.
010000
010100     EVALUATE TRUE
010200         WHEN TAXABLE-INCOME <= BRACKET-1
010300             COMPUTE TAX-AMOUNT = TAXABLE-INCOME * RATE-1
010400
010500         WHEN TAXABLE-INCOME <= BRACKET-2
010600             COMPUTE TAX-AMOUNT = BRACKET-1 * RATE-1
010700                     + (TAXABLE-INCOME - BRACKET-1) * RATE-2
010800
010900         WHEN TAXABLE-INCOME <= BRACKET-3
011000             COMPUTE TAX-AMOUNT = BRACKET-1 * RATE-1
011100                     + (BRACKET-2 - BRACKET-1) * RATE-2
011200                     + (TAXABLE-INCOME - BRACKET-2) * RATE-3
011300
011400         WHEN TAXABLE-INCOME <= BRACKET-4
011500             COMPUTE TAX-AMOUNT = BRACKET-1 * RATE-1
011600                     + (BRACKET-2 - BRACKET-1) * RATE-2
011700                     + (BRACKET-3 - BRACKET-2) * RATE-3
011800                     + (TAXABLE-INCOME - BRACKET-3) * RATE-4
011900
012000         WHEN TAXABLE-INCOME <= BRACKET-5
012100             COMPUTE TAX-AMOUNT = BRACKET-1 * RATE-1
012200                     + (BRACKET-2 - BRACKET-1) * RATE-2
012300                     + (BRACKET-3 - BRACKET-2) * RATE-3
012400                     + (BRACKET-4 - BRACKET-3) * RATE-4
012500                     + (TAXABLE-INCOME - BRACKET-4) * RATE-5
012600
012700         WHEN TAXABLE-INCOME <= BRACKET-6
012800             COMPUTE TAX-AMOUNT = BRACKET-1 * RATE-1
012900                     + (BRACKET-2 - BRACKET-1) * RATE-2
013000                     + (BRACKET-3 - BRACKET-2) * RATE-3
013100                     + (BRACKET-4 - BRACKET-3) * RATE-4
013200                     + (BRACKET-5 - BRACKET-4) * RATE-5
013300                     + (TAXABLE-INCOME - BRACKET-5) * RATE-6
013400
013500         WHEN OTHER
013600             COMPUTE TAX-AMOUNT = BRACKET-1 * RATE-1
013700                     + (BRACKET-2 - BRACKET-1) * RATE-2
013800                     + (BRACKET-3 - BRACKET-2) * RATE-3
013900                     + (BRACKET-4 - BRACKET-3) * RATE-4
014000                     + (BRACKET-5 - BRACKET-4) * RATE-5
014100                     + (BRACKET-6 - BRACKET-5) * RATE-6
014200                     + (TAXABLE-INCOME - BRACKET-6) * RATE-7
014300     END-EVALUATE.
014400
014500 CALCULATION-COMPLETE.
014600     EXIT.
014700
014800 DISPLAY-RESULTS.
014900     MOVE GROSS-INCOME TO DISPLAY-INCOME.
015000     MOVE TAXABLE-INCOME TO DISPLAY-TAXABLE.
015100     MOVE TAX-AMOUNT TO DISPLAY-TAX.
015200     COMPUTE DISPLAY-NET = GROSS-INCOME - TAX-AMOUNT.
015300
015400     DISPLAY " ".
015500     DISPLAY "计算结果 (Calculation Results):".
015600     DISPLAY "=============================================".
015700     DISPLAY "总收入 (Gross Income):        RMB " DISPLAY-INCOME.
015800     DISPLAY "应纳税所得额 (Taxable Income): RMB " DISPLAY-TAXABLE.
015900     DISPLAY "个人所得税 (Income Tax):      RMB " DISPLAY-TAX.
016000     DISPLAY "净收入 (Net Income):         RMB " DISPLAY-NET.
016100     DISPLAY "=============================================".
016200
016300 END PROGRAM CHINESE-TAX-SYSTEM.